package caiwei.android.adapter.base;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.widget.BaseAdapter;

/**
 * 基础适配器类，抽象类，getView子类去实现
 * 
 * @author caiwei
 * @date2012-3-5
 * @version 1.0
 */
public abstract class AdapterBase extends BaseAdapter
{
	// 存放传入的数据
	private List<?> mList;
	// 存放上下文
	private Context mContext;
	// 存放压力泵，用于加载布局
	private LayoutInflater mLayoutInflater;

	public AdapterBase(Context pContext, List<?> pList)
	{
		mContext = pContext;
		mList = pList;
		mLayoutInflater = LayoutInflater.from(mContext);
	}

	public Context getContext()
	{
		return mContext;
	}

	public LayoutInflater getLayoutInflater()
	{
		return mLayoutInflater;
	}

	public List<?> getList()
	{
		return mList;
	}

	public void setList(List<?> mList)
	{
		this.mList = mList;
	}

	@Override
	public int getCount()
	{
		return mList.size();
	}

	@Override
	public Object getItem(int pPosition)
	{
		return mList.get(pPosition);
	}

	@Override
	public long getItemId(int pPosition)
	{
		return pPosition;
	}
}
